import request from "./index";

//查询用户是否收藏了该商品
export interface isLikeAns {
    code: number;
    msg: string;
    data: boolean | Array<any>
}
export const isLike = (carId: string) => {
    return request({
        url: '/userlike/isLike',
        method: 'get',
        params: {
            carId
        }
    })
}

//添加收藏
export interface addLikeAns {
    code: number;
    msg: string;
    data: Array<any>
}
export const addLike = (lid: string,carId: string) => {
    return request({
        url: '/userlike/addLike',
        method: 'post',
        data: {
            lid,
            carId
        }
    })
}

//取消收藏
export interface delLikeAns {
    code: number;
    msg: string;
    data: Array<any>
}
export const delLike = (carId: string) => {
    return request({
        url: '/userlike/delLike',
        method: 'post',
        data: {
            carId
        }
    })
}

//获取用户所有的收藏车辆信息
export interface getLikeAns {
    code: number;
    msg: string;
    data: Array<any>
}
export const getLike = () => {
    return request({
        url: '/userlike/getLike',
        method: 'get'
    })
}